package com.cenntro.oss.controller;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.cenntro.common.base.BaseController;
import com.cenntro.common.util.result.Result;
import com.cenntro.oss.model.dbo.DevPartsDO;
import com.cenntro.oss.service.DevPartsService;
import com.google.common.collect.ImmutableMap;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * <p>
 * 零部件预制信息
 * </p>
 *
 * @author
 * @since 2018-12-08
 */

@Api(value = "零部件", tags = { "零部件选择" })
@RestController
@RequestMapping("/parts")
public class DevPartsController extends BaseController {

	@Resource
	private DevPartsService devPartsService;

	/**
	 * 
	* @Title get
	* @Description 根据料号选择对应的零部件名称
	* @param partsPn
	* @return  
	* @throws
	 */
	@ApiOperation(value = "零部件", notes = "零部件")
	@RequestMapping("/get")
	public Result get(String partsPn) {
		DevPartsDO devPartsDO = devPartsService.selectOne(ImmutableMap.of("partsPn", partsPn));
		Map<String, Object> map = new HashMap<>();
		map.put("partPn", devPartsDO.getPartsPn());
		map.put("partId", devPartsDO.getPartsId());
		map.put("partName", devPartsDO.getPartsName());
		return Result.ok(map);
	}

}
